package models

import (
	"gorm.io/gorm"
)

type UserBasic struct {
	gorm.Model
	Id       int64  `json:"id"`
	Name     string `json:"name"`
	UserName string `json:"user_name"`
	PassWord string `json:"pass_word"`
	// 手机号正则匹配校验
	Phone         string `json:"phone" valid:"matches('/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/'"`
	Email         string `json:"email" valid:"email"`
	ClientIp      string `json:"client_ip"`
	ClientPort    string `json:"client_port"`
	LoginTime     uint64 `json:"login_time"`
	HeartbeatTime uint64 `json:"heartbeat_time"`
	LogOutTime    uint64 `json:"log_out_time"`
}

/*
使用 go get github.com/asaskevich/govalidator
校验邮箱和手机号码的输入修改
*/

func (table *UserBasic) TableName() string {
	return "user_basic"
}
